| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Public Member Functions | List of all members
nkWinUi::ImageManager Class Referencefinal

Manages the images in the component. More...

Inheritance diagram for nkWinUi::ImageManager:

## Public Member Functions
System * | getSystem () const
Image * | createOrRetrieve (nkMemory::StringView name)
Image * | record (nkMemory::StringView name, nkMemory::UniquePtr< Image > resource)
Image * | get (nkMemory::StringView name) const
Image * | getByIndex (unsigned int index) const
void | rename (nkMemory::StringView oldName, nkMemory::StringView newName)
void | erase (nkMemory::StringView name)
nkMemory::UniquePtr< Image > | relinquish (nkMemory::StringView name)

## Detailed Description

Manages the images in the component.

## Member Function Documentation

## ◆ getSystem()

System* nkWinUi::ImageManager::getSystem | ( |  | ) | const

Returns
  The system the manager is living in.

## ◆ createOrRetrieve()

Image* nkWinUi::ImageManager::createOrRetrieve | ( | nkMemory::StringView | name | ) |

Creates if unavailable, or retrieves if available, an image.

Parameters

  name | The name of the image to retrieve.

Returns
  The image requested, possibly freshly created. The manager owns the memory returned, external code should never delete it. See erase().

## ◆ record()

Image* nkWinUi::ImageManager::record | ( | nkMemory::StringView | name,
|  | nkMemory::UniquePtr< Image > | resource
| ) |  |

Records an already existing resource in the manager, passing its ownership around.

Parameters

  name | The name under which the resource should be recorded.
  resource | The resource to record.

Returns
  A raw pointer over the resource, now recorded in the manager.

## ◆ get()

Image* nkWinUi::ImageManager::get | ( | nkMemory::StringView | name | ) | const

Retrieves an image.

Parameters

  name | The name of the image to retrieve.

Returns
  The image requested if available, nullptr else.

## ◆ getByIndex()

Image* nkWinUi::ImageManager::getByIndex | ( | unsigned int | index | ) | const

Get an image, by index. Note that one index can map to a different image after memory is changed. Useful to loop over all available images in one go.

Parameters

  index | The index of the image to retrieve.

Returns
  The image linked if available, nullptr else.

## ◆ rename()

void nkWinUi::ImageManager::rename | ( | nkMemory::StringView | oldName,
|  | nkMemory::StringView | newName
| ) |  |

Renames an image.

Parameters

  oldName | The name of the image to rename.
  newName | The name to reassign to the image.

## ◆ erase()

void nkWinUi::ImageManager::erase | ( | nkMemory::StringView | name | ) |

Erases and frees an image.

Parameters

  name | The name of the image to erase.

## ◆ relinquish()

nkMemory::UniquePtr<Image> nkWinUi::ImageManager::relinquish | ( | nkMemory::StringView | name | ) |

Requests the manager to relinquish the ownership of a resource and pass it around.

Parameters

  name | The name of the recorded resource to relinquish.

Returns
  The ownership over the resource requested if available, nullptr otherwise.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsWinUi/Images/ImageManager.h